<template>
  <div>
    <el-card>
      <el-row :gutter="20">
        <el-switch
            v-model="movieLockSeatSwitch"
            active-color="#13ce66"
            inactive-color="#ff4949"
            active-value="Y"
            active-text="开启锁座"
            inactive-text="关闭锁座"
            inactive-value="N"
            @change="chgSwitch()"
        ></el-switch>
      </el-row>
    </el-card>
  </div>
</template>

<script>
import Api from '@/api/Api.js'
import Util from '@/libs/utils'
export default {
  data() {
    return {
      movieLockSeatSwitch:'Y'
    }
  },
  created() {
    this.getMovieLockSeatSwitch()
  },
  methods: {
    getMovieLockSeatSwitch() {
        Api.getMovieLockSeatSwitch({}).then(res => {
            if (res.success) {
                this.movieLockSeatSwitch = res.data;
            } else {
                return this.$message.error('获取数据失败')
            }
        })
    },
    chgSwitch() {
      Api.saveMovieLockSeatSwitch({'status':this.movieLockSeatSwitch}).then(res => {
        if (res.success) {
          this.$message.success('修改成功！')
        } else {
          return this.$message.error('修改失败: ' + res.msg)
        }
      })
    }
  },
}
</script>

<style lang="less" scoped>
</style>
